Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update across the board ownership changes, url updates #26

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

iainnash
Copy link
Collaborator

Fix URL changes, ownership updates.

Allow appending delete add operations for users to the current transaction queue.

@iainnash iainnash force-pushed the fix_url_generation_editing_and_ownership_changes branch from 3cda71d to 46e4ed2 Compare April 21, 2024 20:36
setParams({
[queryKeys.targets]: proposal.actions!.map((action) => action.to).join("|"),
[queryKeys.calldatas]: proposal.actions!.map((action) => action.data).join("|"),
[queryKeys.values]: proposal.actions!.map((action) => action.value).join("|"),
...(proposal.nonce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great to have a nonce in here!

)}
</SafeInformation>
</View>
<ProposalContext.Provider value={proposal}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we avoid having this in a context and instead pass it down as props? it can be tough to track where context comes from, and also context changes are mutable and dont predictably cause a state change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did this change in a follow on PR #27

@@ -76,7 +74,7 @@ const AddOwnerModalContent = ({ onClose }: { onClose: () => void }) => {
}}
>
<Form>
<Text variant="featured-2">Add Owner</Text>
<Text variant="featured-2">Add Signer</Text>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the other variables be changed to signer too? noticed they all still are called owner

@iainnash
Copy link
Collaborator Author

iainnash commented Apr 22, 2024 via email

Copy link
Contributor

oveddan commented Apr 22, 2024

I tend to avoid using context unless there is a deep component hirhearchy and passing down the props many layers becomes tedious (or if its impossible) - it has downsides in that it's tricky to track state changes and it is a mutable state, which often doesn't cause components to re-render (this was happening before).

Explicitly passing down props has more predictable results and makes sure the components properly re-render and the UI reflects whats in the state

Since we want to be able to pass the url around, we can keep the url as the primary state/source of truth, and update that accordingly; this way the state will be reflected in the current url, and we shouldn't need to duplicate that in a context.

And yeah it also makes sense to remove that other state (it's just a duplicate really)

Do you think this issue would be alleviated if we use the context
everywhere and remove the other state you suggested? would increase perf
and speed up the component tree. another cool benefit is we could auto
update the url from set state through a useUpdateUrl effect.

On Mon, Apr 22, 2024 at 20:10 Dan Oved @.***> wrote:

@.**** commented on this pull request.

In src/app/NewSafeProposal.tsx
#26 (comment):

  •    {isEditing && (
    
  •      <EditProposal
    
  •        proposal={proposal}
    
  •        setProposal={setProposal}
    
  •        setIsEditing={setIsEditing}
    
  •      />
    
  •    )}
    
  •    {!isEditing && proposal && (
    
  •      <ViewProposal
    
  •        proposal={proposal}
    
  •        handleEditClicked={handleEditClicked}
    
  •      />
    
  •    )}
    
  •  </SafeInformation>
    
  • <ProposalContext.Provider value={proposal}>

can we avoid having this in a context and instead pass it down as props?
it can be tough to track where context comes from, and also context changes
are mutable and dont predictably cause a state change.


Reply to this email directly, view it on GitHub
#26 (review),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAGMCODLDMMXTY44YSLBUSDY6VHAPAVCNFSM6AAAAABGRAVWA2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDAMJVGQ4TMNZXGY
.
You are receiving this because you authored the thread.Message ID:
@.***>

Copy link
Contributor

oveddan commented Jun 21, 2024

Merge activity

  • Jun 21, 3:47 PM EDT: @oveddan started a stack merge that includes this pull request via Graphite.
  • Jun 21, 3:47 PM EDT: @oveddan merged this pull request with Graphite.

@oveddan oveddan merged commit 938bde8 into main Jun 21, 2024
1 check failed
oveddan added a commit that referenced this pull request Jun 21, 2024
…icate state, fix creation of a new proposal (#27)

* Better naming around provider updating/namely: `addAction` and `replaceProposal`
* Replace ProviderContext with explicit prop passing; remove duplicate `proposal` state and just have query string be source of truth
* Fix some type failing issues
* When there is no current proposal, and a user is to be added/removed from the safe, redirect to a `new` url so that the url can be properly shared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants